package helloworld.common;

import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

/**
 * @author TUYEN-DM
 *         <p>
 *         2009/05/26
 *         </p>
 *         <p>
 *         CommonUtils is the object representation of utility common functions.
 *         </p>
 */
public class CommonUtils {

	/**
	 * 
	 * @return current date time
	 */
	public String getCurrentDateTime() {
		DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
		Date date = new Date();
		return dateFormat.format(date);
	}

	/**
	 * 2009/05/26
	 * <br>Convert YYYYMMDDHHMMSS to yyyy/MM/dd HH:MM:SS
	 * @param strDate
	 * @return Date String with format yyyy/MM/dd HH:MM:SS
	 */
	public String convertStringToDate(String strDate) {
		return strDate.substring(0, 3) + "/" + strDate.substring(4, 5) + "/"
				+ strDate.substring(6, 7) + " " + strDate.substring(8, 9) + ":"
				+ strDate.substring(10, 11) + ":" + strDate.substring(12, 13);
	}
}
